class TreeNode:
    def __init__(self, val):
        self.val = val
        self.left = None
        self.right = None

    def setLeft(self, left):
        self.left = left

    def setRight(self, right):
        self.right = right


class BST:
    def __init__(self, nums: list[int]):
        self.root = TreeNode(nums[0])
        for i in range(1, len(nums)):
            curr = self.root
            while curr is not None:
                if nums[i] < curr.val:
                    if curr.left is not None:
                        curr = curr.left
                    else:
                        curr.left = TreeNode(nums[i])
                        break
                else:
                    if curr.right is not None:
                        curr = curr.right
                    else:
                        curr.right = TreeNode(nums[i])
                        break


if __name__ == '__main__':
    bst = BST([1, 5, 3, 4, 5, 6, 7, -1])
    print()
